from django.db import models
from django.contrib.auth.models import User


class Word(models.Model):
    english = models.CharField(max_length=32)
    chinese = models.CharField(max_length=32)

    def __str__(self):
        return self.english + ' - ' + self.chinese


class Level(models.Model):
    user = models.ForeignKey(User)
    lives = models.IntegerField(default=0)
    score = models.IntegerField(default=0)
    word = models.ForeignKey(Word, null=True)
    joined = models.DateTimeField(auto_now_add=True)
    ip = models.CharField(max_length=64, blank=True)
